package com.cc.entity;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Set;

/**
 * @ClassName: LoginUser
 * @Description:
 * @Author: 晓东√
 * @Date: 2024-12-16 15:29
 * @Version: 1.0
 **/
@Data
public class LoginUser implements UserDetails {

    private Employees employees;

    private Set<String> setPermissions;

    public LoginUser(Employees user, Set<String> setPermissions) {
        this.employees = user;
        this.setPermissions = setPermissions;
    }

    //权限
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getPassword() {
        return employees.getPassword();
    }

    @Override
    public String getUsername() {
        return employees.getLoginName();
    }

    //账号是否过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }
    //账号是否锁定
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }
    //密码是否过期
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
    //账号是否可以
    @Override
    public boolean isEnabled() {
        return true;
    }
}
